######################################################################
####graphic function to be called by the main function ranking()######

###include a command line at the end of ranking() function, like: plaintable<<-ranking to save 
###the ranking-table to the workspace in r and be able to use it for graphics function.

graphtable<- function(plaintable){      ###function to be called by ranking() with call(graphtable)
                                        ### or source()? 
  
  windows.options(width=6, height=10)   ### set the graphic window size, may not work in linux or apple, alternatively x11()
  plot(1, type="n", axes=F, xlab="", ylab="", asp=1) ###plot a blank plot, with option to have equal 
                                                     ###axes by setting asp to 1
  text(1,1, paste(capture.output(plaintable), collapse="\n"), family="mono", cex=1.5) 
  
  ###plot the data.frame ranking as string into the blank plot
  ### if we just want to plot specific rows/colums we could use capture.output(plaintable)[1] etc.
  
  abline(h = 1, v = 1)  
  grid(nx=ncol(plaintable), ny=nrow(plaintable), equilogs=FALSE)
  ##if we want to attach a grid - but doesnt work
  
  
  #######################################################################################
  ###axis(1) we might be interested in adding axes, to identify where each line starts and ends
  pdf('ranking.pdf')
  dev.off()
  
}

